using UnityEngine;

public class LookButton : MonoBehaviour
{
	public new UILabel name;

	public Color selectedColour;

	public Color deselectedColour;

	private CustomisationConfig.Look myLook;

	private int myLookId;

	private LookSetPicker myPicker;

	public void Init(CustomisationConfig.Look look, int lookId, LookSetPicker picker)
	{
		myLook = look;
		myLookId = lookId;
		myPicker = picker;
		base.gameObject.SetActive(true);
		UITools.ChangeText(name, look.lookName);
	}

	public void UpdateLookSelection(bool isSelected)
	{
		UIWidget component = GetComponent<UIWidget>();
		component.color = ((!isSelected) ? deselectedColour : selectedColour);
		UIButton component2 = GetComponent<UIButton>();
		component2.defaultColor = ((!isSelected) ? deselectedColour : selectedColour);
		component2.UpdateColor(true, true);
	}

	public void OnSelectLook()
	{
		myPicker.LookSelected(myLook);
		UpdateLookSelection(true);
	}

	private void Update()
	{
		if (myLook != null)
		{
			UITools.ChangeText(name, myLook.lookName);
		}
	}
}
